<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Class: Workspace</title>

	<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

	<script src="./js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="class">

	<div id="metadata">
		<div id="home-metadata">
			<div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
			</div>
		</div>

		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="./app/models/workspace_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="app/models/workspace.rb">app/models/workspace.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			
			<div id="parent-class-section" class="section">
				<h3 class="section-header">Parent</h3>
				
				<p class="link">ActiveRecord::Base</p>
				
			</div>
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#method-i-to_hash">#to_hash</a></li>
					
					<li><a href="#method-i-update_with_json">#update_with_json</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
		</div>

		<div id="project-metadata">
			
			
			<div id="fileindex-section" class="section project-section">
				<h3 class="section-header">Files</h3>
				<ul>
				
					<li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a></li>
				
				</ul>
			</div>
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="./images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="./Tools.html">Tools</a></li>
				
					<li><a href="./Tools/Image.html">Tools::Image</a></li>
				
					<li><a href="./Tools/ImagesController.html">Tools::ImagesController</a></li>
				
					<li><a href="./Tools/ImagesHelper.html">Tools::ImagesHelper</a></li>
				
					<li><a href="./ApplicationController.html">ApplicationController</a></li>
				
					<li><a href="./ApplicationHelper.html">ApplicationHelper</a></li>
				
					<li><a href="./AssocProfileType.html">AssocProfileType</a></li>
				
					<li><a href="./AssocProfileTypesController.html">AssocProfileTypesController</a></li>
				
					<li><a href="./AssocProfileTypesHelper.html">AssocProfileTypesHelper</a></li>
				
					<li><a href="./AssocWorkspaceProfile.html">AssocWorkspaceProfile</a></li>
				
					<li><a href="./AssocWorkspaceProfilesController.html">AssocWorkspaceProfilesController</a></li>
				
					<li><a href="./AssocWorkspaceProfilesHelper.html">AssocWorkspaceProfilesHelper</a></li>
				
					<li><a href="./Document.html">Document</a></li>
				
					<li><a href="./DocumentsController.html">DocumentsController</a></li>
				
					<li><a href="./DocumentsHelper.html">DocumentsHelper</a></li>
				
					<li><a href="./EditionArea.html">EditionArea</a></li>
				
					<li><a href="./Eo.html">Eo</a></li>
				
					<li><a href="./EoType.html">EoType</a></li>
				
					<li><a href="./EoTypesController.html">EoTypesController</a></li>
				
					<li><a href="./EoTypesHelper.html">EoTypesHelper</a></li>
				
					<li><a href="./InstructionBox.html">InstructionBox</a></li>
				
					<li><a href="./PagesController.html">PagesController</a></li>
				
					<li><a href="./PagesHelper.html">PagesHelper</a></li>
				
					<li><a href="./Profile.html">Profile</a></li>
				
					<li><a href="./ProfilesController.html">ProfilesController</a></li>
				
					<li><a href="./ProfilesHelper.html">ProfilesHelper</a></li>
				
					<li><a href="./PropertyBox.html">PropertyBox</a></li>
				
					<li><a href="./ToolBox.html">ToolBox</a></li>
				
					<li><a href="./Workspace.html">Workspace</a></li>
				
					<li><a href="./WorkspacesController.html">WorkspacesController</a></li>
				
					<li><a href="./WorkspacesHelper.html">WorkspacesHelper</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="class">Workspace</h1>

		<div id="description">
			<h2>Schema Information</h2>
<p>
Schema version: 20101204202135
</p>
<p>
Table name: workspaces
</p>
<pre>
 id                 :integer         not null, primary key
 current_profile_id :integer
 created_at         :datetime
 updated_at         :datetime</pre>

		</div>

		<!-- Constants -->
		

		<!-- Attributes -->
		

		<!-- Methods -->
		
		<div id="public-instance-method-details" class="method-section section">
			<h3 class="section-header">Public Instance Methods</h3>

		
			<div id="to-hash-method" class="method-detail ">
				<a name="method-i-to_hash"></a>

				<div class="method-heading">
				
					<span class="method-name">to_hash</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="to-hash-source">
<pre>
     <span class="ruby-comment cmt"># File app/models/workspace.rb, line 115</span>
115:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
116:     <span class="ruby-identifier">as_json</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>
117:     
118:     <span class="ruby-identifier">all_workspace_data</span> = {}
119:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;id&quot;</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>
120:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;current_profile_id&quot;</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current_profile_id</span>
121: 
122:     <span class="ruby-comment cmt"># Preparing profiles data</span>
123:     <span class="ruby-identifier">all_profiles_array</span> = []
124:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">profiles</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">profile</span><span class="ruby-operator">|</span>      
125:       <span class="ruby-identifier">all_profiles_array</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">profile</span>.<span class="ruby-identifier">id</span>           
126:     <span class="ruby-keyword kw">end</span>   
127:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;profiles&quot;</span>] = <span class="ruby-identifier">all_profiles_array</span>
128:     
129:     
130:     <span class="ruby-comment cmt"># Preparing instruction boxes data</span>
131:     <span class="ruby-identifier">all_instruction_boxes_array</span> = []
132:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instruction_boxes</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">instruction_box</span><span class="ruby-operator">|</span> 
133:       <span class="ruby-identifier">instruction_box_data</span> = {}
134:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;id&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">instruction_box_id</span>  
135:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">parent_id</span>
136:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;top&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">top</span>
137:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;left&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">left</span>
138:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;width&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">width</span>
139:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;height&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">height</span>
140:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">title</span>
141:       <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>] = <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">css_path</span>     
142:       <span class="ruby-identifier">all_instruction_boxes_array</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">instruction_box_data</span>           
143:     <span class="ruby-keyword kw">end</span>
144:     
145:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;instruction_boxes&quot;</span>] = <span class="ruby-identifier">all_instruction_boxes_array</span>
146:     
147:     <span class="ruby-comment cmt"># Preparing property boxes data</span>
148:     <span class="ruby-identifier">all_property_boxes_array</span> = []
149:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">property_boxes</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">property_box</span><span class="ruby-operator">|</span> 
150:       <span class="ruby-identifier">property_box_data</span> = {}
151:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;id&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">property_box_id</span>  
152:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">parent_id</span>
153:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;top&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">top</span>
154:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;left&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">left</span>
155:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;width&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">width</span>
156:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;height&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">height</span>
157:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">title</span>
158:       <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>] = <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">css_path</span>     
159:       <span class="ruby-identifier">all_property_boxes_array</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">property_box_data</span>           
160:     <span class="ruby-keyword kw">end</span>
161:     
162:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;property_boxes&quot;</span>] = <span class="ruby-identifier">all_property_boxes_array</span>
163:     
164:     <span class="ruby-comment cmt"># Preparing toolboxes data</span>
165:     <span class="ruby-identifier">all_tool_boxes_array</span> = []
166:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tool_boxes</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tool_box</span><span class="ruby-operator">|</span> 
167:       <span class="ruby-identifier">tool_box_data</span> = {}
168:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;id&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">tool_box_id</span>  
169:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">parent_id</span>
170:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;top&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">top</span>
171:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;left&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">left</span>
172:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;width&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">width</span>
173:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;height&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">height</span>
174:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">title</span>
175:       <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>] = <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">css_path</span>     
176:       <span class="ruby-identifier">all_tool_boxes_array</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tool_box_data</span>           
177:     <span class="ruby-keyword kw">end</span>
178:     
179:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;tool_boxes&quot;</span>] = <span class="ruby-identifier">all_tool_boxes_array</span>
180:     
181:     <span class="ruby-comment cmt"># Preparing edition area data</span>
182:     <span class="ruby-identifier">all_edition_areas_array</span> = []
183:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">edition_areas</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">edition_area</span><span class="ruby-operator">|</span> 
184:       <span class="ruby-identifier">edition_area_data</span> = {}
185:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;id&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">edition_area_id</span>  
186:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">parent_id</span>
187:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;top&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">top</span>
188:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;left&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">left</span>
189:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;width&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">width</span>
190:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;height&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">height</span>
191:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">title</span>
192:       <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>] = <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">css_path</span>     
193:       <span class="ruby-identifier">all_edition_areas_array</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">edition_area_data</span>           
194:     <span class="ruby-keyword kw">end</span>
195:     
196:     <span class="ruby-identifier">all_workspace_data</span>[<span class="ruby-value str">&quot;edition_areas&quot;</span>] = <span class="ruby-identifier">all_edition_areas_array</span>
197:     
198:     <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">all_workspace_data</span>
199:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="update-with-json-method" class="method-detail ">
				<a name="method-i-update_with_json"></a>

				<div class="method-heading">
				
					<span class="method-name">update_with_json</span><span
						class="method-args">(json)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="update-with-json-source">
<pre>
     <span class="ruby-comment cmt"># File app/models/workspace.rb, line 20</span>
 20:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_with_json</span>(<span class="ruby-identifier">json</span>)
 21:     <span class="ruby-identifier">as_json</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>
 22:     
 23:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current_profile_id</span> = <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;current_profile&quot;</span>]
 24:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">save</span>
 25:     
 26:     <span class="ruby-comment cmt"># Remove old associations</span>
 27:     <span class="ruby-constant">AssocWorkspaceProfile</span>.<span class="ruby-identifier">find_all_by_workspace_id</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">assoc</span><span class="ruby-operator">|</span>
 28:       <span class="ruby-constant">AssocWorkspaceProfile</span>.<span class="ruby-identifier">destroy</span>(<span class="ruby-identifier">assoc</span>);
 29:     <span class="ruby-keyword kw">end</span>
 30:     
 31:     <span class="ruby-comment cmt"># Save new associations</span>
 32:     <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;profiles&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">profile</span><span class="ruby-operator">|</span>
 33:       <span class="ruby-identifier">assoc_workspace_profile</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assoc_workspace_profiles</span>.<span class="ruby-identifier">build</span>
 34:       <span class="ruby-identifier">assoc_workspace_profile</span>.<span class="ruby-identifier">profile_id</span> = <span class="ruby-identifier">profile</span> 
 35:       <span class="ruby-identifier">assoc_workspace_profile</span>.<span class="ruby-identifier">save</span>
 36:     <span class="ruby-keyword kw">end</span>
 37:     
 38:     <span class="ruby-comment cmt"># Remove old instruction_boxes</span>
 39:     <span class="ruby-constant">InstructionBox</span>.<span class="ruby-identifier">find_all_by_workspace_id</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">instruction_box</span><span class="ruby-operator">|</span>
 40:       <span class="ruby-constant">InstructionBox</span>.<span class="ruby-identifier">destroy</span>(<span class="ruby-identifier">instruction_box</span>);
 41:     <span class="ruby-keyword kw">end</span>
 42:     
 43:     <span class="ruby-comment cmt"># Save new instruction_boxes</span>
 44:     <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;instruction_boxes&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">instruction_box_data</span><span class="ruby-operator">|</span>
 45:       <span class="ruby-identifier">instruction_box</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instruction_boxes</span>.<span class="ruby-identifier">build</span>
 46:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">instruction_box_id</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;id&quot;</span>]
 47:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">parent_id</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>]
 48:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">top</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;top&quot;</span>]
 49:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">left</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;left&quot;</span>]
 50:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">width</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;width&quot;</span>]
 51:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">height</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;height&quot;</span>]
 52:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] 
 53:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">css_path</span> = <span class="ruby-identifier">instruction_box_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>]
 54:       <span class="ruby-identifier">instruction_box</span>.<span class="ruby-identifier">save</span>
 55:     <span class="ruby-keyword kw">end</span>
 56:     
 57:     <span class="ruby-comment cmt"># Remove old property_boxes</span>
 58:     <span class="ruby-constant">PropertyBox</span>.<span class="ruby-identifier">find_all_by_workspace_id</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">property_box</span><span class="ruby-operator">|</span>
 59:       <span class="ruby-constant">PropertyBox</span>.<span class="ruby-identifier">destroy</span>(<span class="ruby-identifier">property_box</span>);
 60:     <span class="ruby-keyword kw">end</span>
 61:     
 62:     <span class="ruby-comment cmt"># Save new property_boxes</span>
 63:     <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;property_boxes&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">property_box_data</span><span class="ruby-operator">|</span>
 64:       <span class="ruby-identifier">property_box</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">property_boxes</span>.<span class="ruby-identifier">build</span>
 65:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">property_box_id</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;id&quot;</span>]
 66:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">parent_id</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>]
 67:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">top</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;top&quot;</span>]
 68:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">left</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;left&quot;</span>]
 69:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">width</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;width&quot;</span>]
 70:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">height</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;height&quot;</span>]
 71:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] 
 72:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">css_path</span> = <span class="ruby-identifier">property_box_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>]
 73:       <span class="ruby-identifier">property_box</span>.<span class="ruby-identifier">save</span>
 74:     <span class="ruby-keyword kw">end</span>  
 75:     
 76:     <span class="ruby-comment cmt"># Remove old tool_boxes</span>
 77:     <span class="ruby-constant">ToolBox</span>.<span class="ruby-identifier">find_all_by_workspace_id</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tool_box</span><span class="ruby-operator">|</span>
 78:       <span class="ruby-constant">ToolBox</span>.<span class="ruby-identifier">destroy</span>(<span class="ruby-identifier">tool_box</span>);
 79:     <span class="ruby-keyword kw">end</span>
 80:     
 81:     <span class="ruby-comment cmt"># Save new tool_boxes</span>
 82:     <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;tool_boxes&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tool_box_data</span><span class="ruby-operator">|</span>
 83:       <span class="ruby-identifier">tool_box</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tool_boxes</span>.<span class="ruby-identifier">build</span>
 84:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">tool_box_id</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;id&quot;</span>]
 85:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">parent_id</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>]
 86:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">top</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;top&quot;</span>]
 87:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">left</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;left&quot;</span>]
 88:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">width</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;width&quot;</span>]
 89:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">height</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;height&quot;</span>]
 90:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] 
 91:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">css_path</span> = <span class="ruby-identifier">tool_box_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>]
 92:       <span class="ruby-identifier">tool_box</span>.<span class="ruby-identifier">save</span>
 93:     <span class="ruby-keyword kw">end</span>
 94:   
 95:     <span class="ruby-comment cmt"># Remove old edition_areaes</span>
 96:     <span class="ruby-constant">EditionArea</span>.<span class="ruby-identifier">find_all_by_workspace_id</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">edition_area</span><span class="ruby-operator">|</span>
 97:       <span class="ruby-constant">EditionArea</span>.<span class="ruby-identifier">destroy</span>(<span class="ruby-identifier">edition_area</span>);
 98:     <span class="ruby-keyword kw">end</span>
 99:     
100:     <span class="ruby-comment cmt"># Save new edition_areas</span>
101:     <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;edition_areas&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">edition_area_data</span><span class="ruby-operator">|</span>
102:       <span class="ruby-identifier">edition_area</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">edition_areas</span>.<span class="ruby-identifier">build</span>
103:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">edition_area_id</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;id&quot;</span>]
104:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">parent_id</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;parent&quot;</span>]
105:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">top</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;top&quot;</span>]
106:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">left</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;left&quot;</span>]
107:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">width</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;width&quot;</span>]
108:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">height</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;height&quot;</span>]
109:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;title&quot;</span>] 
110:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">css_path</span> = <span class="ruby-identifier">edition_area_data</span>[<span class="ruby-value str">&quot;css_path&quot;</span>]
111:       <span class="ruby-identifier">edition_area</span>.<span class="ruby-identifier">save</span>
112:     <span class="ruby-keyword kw">end</span>
113:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

